<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>更新会员信息</title>


    <link rel="stylesheet" href="/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="/dist/css/laypage.css">

    <script type="text/javascript" src="/dist/js/vue/vue.min.js"></script>
    <script type="text/javascript" src="/dist/js/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/dist/js/jquery.validation/1.14.0/jquery.validate.min.js"></script>
    <script src="/dist/js/jquery.validation/1.14.0/messages_zh.min.js"></script>

    <style type="text/css">
        input.error {
            border: 1px solid red;
        }
    </style>
</head>
<body>
<div id="app" class="container">
    <form id="id-from-update" class="form-inline bg-danger" role="form">
        <input type="hidden" name="mid" value="${member111.mid}">
        <div class="form-group">
            <label class="sr-only" for="maccount">用户名称</label>
            <input type="text" class="form-control" id="maccount" name="maccount" placeholder="用户账号" value="${member111.maccount}">
        </div>
        <div class="form-group">
            <label class="sr-only" for="mpwd">用户密码</label>
            <input type="text" class="form-control" id="mpwd" name="mpwd" placeholder="用户密码" value="${member111.mpwd}">
        </div>
        <div class="form-group">
            <label class="sr-only" for="mphone">用户手机号</label>
            <input type="text" class="form-control" id="mphone"  name="mphone" placeholder="用户手机号" value="${member111.mphone}">
        </div>
        <div class="form-group">
            <label class="sr-only" for="mname">用户名字</label>
            <input type="text" class="form-control" id="mname"  name="mname" placeholder="用户名字" value="${member111.mname}">
        </div>
        <div class="form-group">
            <label class="sr-only" for="mpic">用户头像</label>
            <input type="text" class="form-control" id="mpic"  name="mpic" placeholder="用户头像" value="${member111.mpic}">
        </div>

        <button type="button" id="updateUserBtn" class="btn btn-success">更新</button>
        <button type="button" id="cancleUserBtn" class="btn btn-danger">取消</button>
    </form>
</div>
</body>
</html>
<script type="text/javascript">


    var updateMember=function(){
        if (!check().form()){
            return;
        }

        $.ajax({
            type:"post",
            url:"/updateRecord111.dojava",
            data:$("#id-from-update").serialize(),
            success:function (msg) {
                console.log("msg======"+msg);
                console.log(msg);
                $("#cancleUserBtn").click();
            }
        });

    };

    $("#updateUserBtn").click(function () {
        console.log("111触发了更新会员的点击事件");
        updateMember();
    });

    $("#cancleUserBtn").click(function () {
        console.log("111触发了取消更新会员的点击事件");
        var index=parent.layer.getFrameIndex(window.name);
        parent.getMemberList();
        parent.layer.close(index);
    });


    /*Jquery表单验证*/
    function check(){
        return $("#id-from-update").validate({
            rules:{
                maccount:{required:true},
                mpwd:{required:true},
                mname:{required:true},
                mphone:{required:true},
                mpic:{required:true}
            },
            messages:{
                maccount:"",
                mpwd:"",
                mname:"",
                mphone:"",
                mpic:""
            }
        });
    }



</script>